package com.frx.leetcode.classify.array;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

/**
 * Created with IDEA
 *
 * @author: xrf
 * @Date: 2019/11/6
 * @Time: 20:10
 */
public class ReverseNum {

    public static void main(String[] args){
        System.out.println(solution(1));
        File file = new File("a.txt");
        LinkedHashMap<Integer,Integer> linkedHashMap = new LinkedHashMap<>();
        try {
            InputStream inputStream = new FileInputStream(file);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
    public static boolean solution(int num){
        if (num<0){
            return false;
        }
        int n = num;
        List<Integer> list = new ArrayList<>();
        while (n/10 != 0){
            list.add(n%10);
            n=n/10;
        }
        list.add(n);
        int num2 = 0;
        System.out.println(list);
        for (int i=0;i<list.size();i++){
            num2= num2 + list.get(i)*(int) Math.pow(10,list.size()-1-i);
        }
        System.out.println(num2);

        return num2 == num;
    }

}
